package com.zsk.shop.common.enums;

/**
 * @author ljh
 * @create 2021/5/8 15:40
 */
public enum EnumDefaultAvatar {
    A("青年女散", "https://oss.zhishangkeapp.com/icon/chn/avatar/1.png", 0),
    B("老人男", "https://oss.zhishangkeapp.com/icon/chn/avatar/2.png", 1),
    C("青年女黑", "https://oss.zhishangkeapp.com/icon/chn/avatar/3.png", 2),
    D("青年女棕", "https://oss.zhishangkeapp.com/icon/chn/avatar/4.png", 3),
    E("青年男1", "https://oss.zhishangkeapp.com/icon/chn/avatar/5.png", 4),
    F("青年男2", "https://oss.zhishangkeapp.com/icon/chn/avatar/6.png", 5),
    G("青年男镜1", "https://oss.zhishangkeapp.com/icon/chn/avatar/7.png", 6),
    H("青年女镜1", "https://oss.zhishangkeapp.com/icon/chn/avatar/8.png", 7),
    I("青年女镜2", "https://oss.zhishangkeapp.com/icon/chn/avatar/9.png", 8),
    J("青年男3", "https://oss.zhishangkeapp.com/icon/chn/avatar/10.png", 9);

    private String name;
    private String url;
    private Integer id;

    EnumDefaultAvatar(String name, String url, Integer id) {
        this.name = name;
        this.url = url;
        this.id = id;
    }

    public static String getRandomUrl() {
        Integer id = (int) (Math.random() * 10);
        EnumDefaultAvatar[] enums = EnumDefaultAvatar.values();
        for (int i = 0; i < enums.length; i++) {
            if (enums[i].getId().equals(id)) {
                return enums[i].getUrl();
            }
        }
        return "";
    }

    public static void main(String[] args) {
        for (int i = 0; i < 100; i++) {
            System.out.println(getRandomUrl());
        }
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }
}
